import 'dart:convert';
import 'package:enterprise_v6_app/app/data/common/choice_bean.dart';
import 'package:enterprise_v6_app/generated/json/base/json_field.dart';
import 'package:enterprise_v6_app/generated/json/department_entity.g.dart';
export 'package:enterprise_v6_app/generated/json/department_entity.g.dart';

///部门实体类
///流程目录树结构共用
@JsonSerializable()
class DepartmentEntity extends ChoiceBean {
  DepartmentEntity();

  factory DepartmentEntity.fromJson(Map<String, dynamic> json) => $DepartmentEntityFromJson(json);
  int? bindStatus = 0;
  List<DepartmentEntity>? children;
  String? companyCode = '';
  String? createBy = '';
  String? createDate = '';
  int? departmentLevel = 0;
  String? departmentName = '';
  String? id = '';
  String? parentId = '';
  String? path = '';
  String? updateBy = '';
  String? updateDate = '';

  ///	级别，顶级为1
  int? level = 0;

  ///	作业单位类型 0：内部 1：第三方
  int? workDepartmentType = 0;

  Map<String, dynamic> toJson() => $DepartmentEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }

  @override
  String getId() {
    return id ?? '';
  }

  @override
  String getShowName() {
    return departmentName ?? '';
  }
}
